<?php
class SortItems extends CWidget
{
	public function run(){
		$page = max(1,(int)$_GET['page']);
		$cid = (int)$_GET['cid'];
		$sort = 'credit_desc';	//默认按信用排序
		if(isset($_GET['sort']) && in_array($_GET['sort'],array('commissionNum_desc','credit_desc'))){
			$sort=$_GET['sort'];
		}
		$creditClass = ($sort=='commissionNum_desc') ? 'itemsort activesort' : 'itemsort';
		$priceClass = ($sort=='commissionNum_desc') ? 'itemsort' : 'itemsort activesort';
		echo CHtml::link('按信用排序', array('item/list','cid'=>$cid,'sort'=>'credit_desc','page'=>$page), array('title'=>'按信用由高到低排序','class'=>$creditClass));
		echo CHtml::link('按销量排序', array('item/list','cid'=>$cid,'sort'=>'commissionNum_desc','page'=>$page), array('title'=>'按30天内的销量及信用混合排序','class'=>$priceClass));
	}
}
?>
